package com.baihang.platform.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import com.baihang.framework.controller.BaseController;
import com.baihang.platform.service.GroupService;

@Controller
@RequestMapping("/group")
public class GroupController extends BaseController {
	
	@Autowired
	private GroupService service;
	@RequestMapping
	public String index() {
		
		return "/platform/group/index";
	}
	
	@ResponseBody
	@GetMapping(value="/getGroupEntityListJson", produces="application/json;charset=UTF-8")
	public String getGroupEntityListJson() {
		String json = service.getGroupJson();
		System.err.println(json);

		return json.replace("[null]", "\"\"");
	}
	
	public static void main(String[] args) {
		String ss="[{\"date\":\"2018-12-05 00:00:00\",\"children\":[null],\"name\":\"总部\",\"id\":\"d3b5771389cd4ff38971d4e6d6f2feb2\"}]";
	    System.out.println(ss.replace("[null]", "\"\""));
	}
}
